<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增用户</title>
<style type="text/css">
	#yjc {
		width: 400px;
		height: 240px;
		margin: 0px;
		padding: 30px 0;
	}
	#xpz{
		margin-top: 80px;
	}
	body{
		background-color:#FFF5EE;
	}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function checkYhm(str){
	$.post('checkYhm?yhm='+str,function(data){
		$('#userErr').html(data);
	});
}

function yanz(){
	var a = document.forms["myForm"]["yhm"].value;
	var b = document.forms["myForm"]["pwd"].value;
	var c = document.forms["myForm"]["name"].value;
	var d = document.forms["myForm"]["money"].value;
	var e = document.forms["myForm"]["phone"].value;
	var f = document.forms["myForm"]["dz"].value;
	if(a==""||a==null||a%1!=0){
		alert("用户名为空或卡号输入非法！");
		return false;
	}else if(b==""||b==null){
		alert("密码未输入！");
		return false;
	}else if(c==""||c==null){
		alert("姓名未输入！");
		return false;
	}else if(!(/^[0-9][0-9]*$/.test(d))){
		alert("存款金额输入非法，请重新输入！");
	    return false;
	}else if(e==""||e==null){
		alert("手机号未填！");
		return false;
	}else if(!(/^[0-9][0-9]*$/.test(e))||e.length!=11){
		alert("请输入正确的手机号！");
		return false;
	}else if(f==""||f==null){
		alert("请输入地址！");
		return false;
	}else{
		alert("新增用户成功！");
		return true;
	}
}
</script>
</head>
<body>
<center>
<div id="xpz">
		<img alt="" src="beijing/logo.jpg" width="650px" height="180px">
	</div>
<div id = "yjc">
<form name="myForm" action="Xinzeng" method="post"  onsubmit="return yanz()">
<h1 style="color:#000000">新增用户</h1>
	<table>
		<tbody>
			<tr>
				<td>
					<input type="hidden" name="qx" value=1>
				</td>
			</tr>
			<tr>
				<td>卡号：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="yhm"  placeholder="用户的银行卡号" onchange="checkYhm(this.value);">
					<br/>
					<font color="red" id="userErr"></font>
				</td>
			</tr>
			<tr>
				<td>密码：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="pwd"  placeholder="请让用户输入密码">
				</td>
			</tr>
			<tr>
				<td>姓名：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="name"  placeholder="请输入用户真实姓名">
				</td>
			</tr>
			<tr>
				<td>存款：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="money"  placeholder="请输入用户存款金额">
				</td>
			</tr>
			<tr>
				<td>手机号：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="phone"  placeholder="请输入正确的手机号">
				</td>
			</tr>
			<tr>
				<td>地址：</td>
			</tr>
			<tr>
				<td>
					<input type="text" name="dz"  placeholder="请输入所在地址">
				</td>
			</tr>
			<tr></tr><tr></tr><tr></tr>
			<tr>
				<td>
					<input type="submit" value="提交">&emsp;
					<input type="reset" value="重置">&emsp;
					<input type="button" value="返回" onclick="window.location='glwelcome.jsp'">
				</td>
		</tr>
		</tbody>
	</table>
</form>
</div>
</center>
</body>
</html>